﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'V' AND name = 'VTableColumns')
	BEGIN
		DROP  View esf_sso.VTableColumns
	END
GO

CREATE View esf_sso.VTableColumns AS

	SELECT 
		T.name							TableName
		,SCHEMA_NAME(T.schema_id)		SchemaName
		,C.name							ColumnName
		,TYPE_NAME (C.system_type_id)	ColumnType
		,C.Collation_Name				ColumnCollationName
		,C.Is_Nullable					ColumnIsNullable
		,C.max_length					ColumnMaxLength
		,C.precision					ColumnPrecision
	FROM 
		sys.tables AS T
	INNER JOIN 
		sys.columns C ON 
			T.OBJECT_ID = C.OBJECT_ID

GO